trait Logger{
    def log(message:String):Unit = {
        println(message)
    }
}

class Calulator extends Logger{
    def add(x:Int, y:Int):Int = {
        val result = x + y
        log("adding " + x + " and " + y+",Result: "+result)
        x + y
    }
    def subtract(x:Int, y:Int):Int = {
        val result = x - y
        log("subtracting " + x + " and " + y+",Result: "+result)
        x - y
    }
}
object Main{
    def main(args:Array[String]):Unit = {
        val calculator = new Calulator()
        calculator.add(1,2)
        calculator.subtract(1,2)
    }
}